﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="school.*,school.dao.*,school.entity.*,util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录处理页面</title>
</head>
<body>
    <%
        request.setCharacterEncoding("UTF-8");
        //获取请求数据
           request.setCharacterEncoding("UTF-8");
	    int stuno = Integer.parseInt(request.getParameter("stuno").trim());
	    String pass = request.getParameter("pass").trim();
        boolean valid = false;  //判断用户验证是否成功
         MySqlStudentDaoImpl obj = new MySqlStudentDaoImpl();
        if(obj.login(stuno, pass)){
             valid = true;
             //设置用户登录信息
             session.setAttribute("login", stuno);
             //设置session过期时间
             session.setMaxInactiveInterval(10*60);
        }
        if (valid) {
            request.getRequestDispatcher("showScore.jsp").forward(request,response);
        } else {
                response.sendRedirect("register.jsp");
        }
    %>
    </body>
</html>
